From 9c0f0bb4514b1defc32c133afef4237f4e509894 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 4 Apr 2006 04:14:17 +0000 Subject: [PATCH] Small savings --- ChangeLog | 2 ++ ChangeLog.pre-2-10 | 2 ++ gdk-pixbuf/ChangeLog | 5 +++++ gdk-pixbuf/gdk-pixbuf.c | 6 +----- gdk/gdkrgb.c | 22 ++++++---------------- gtk/gtkicontheme.c | 9 ++++----- 6 files changed, 20 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index d524cd597f..c920238f91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2006-04-03 Matthias Clasen + * gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names. + * gtk/gtkmain.c: Make gtk_args const. * gtk/gtkicontheme.c (pixbuf_supports_svg): Save one static. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d524cd597f..c920238f91 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,7 @@ 2006-04-03 Matthias Clasen + * gdk/gdkrgb.c: Get rid of a duplicate copy of the visual names. + * gtk/gtkmain.c: Make gtk_args const. * gtk/gtkicontheme.c (pixbuf_supports_svg): Save one static. diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index aa97701fc5..9a4b09b9ad 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +2006-04-04 Matthias Clasen + + * gdk-pixbuf.c: No point in making the error path fast by + caching quarks. + 2006-03-24 Matthias Clasen * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Remove a diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c index 8847c734e5..1bebc9b61a 100644 --- a/gdk-pixbuf/gdk-pixbuf.c +++ b/gdk-pixbuf/gdk-pixbuf.c @@ -542,11 +542,7 @@ GDK_PIXBUF_VAR const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION; GQuark gdk_pixbuf_error_quark (void) { - static GQuark q = 0; - if (q == 0) - q = g_quark_from_static_string ("gdk-pixbuf-error-quark"); - - return q; + return g_quark_from_static_string ("gdk-pixbuf-error-quark"); } /** diff --git a/gdk/gdkrgb.c b/gdk/gdkrgb.c index a7aa8920ba..d6e481f850 100644 --- a/gdk/gdkrgb.c +++ b/gdk/gdkrgb.c @@ -54,16 +54,6 @@ typedef void (*GdkRgbConvFunc) (GdkRgbInfo *image_info, GdkImage *image, gint x_align, gint y_align, GdkRgbCmap *cmap); -static const gchar *const visual_names[] = -{ - "static gray", - "grayscale", - "static color", - "pseudo color", - "true color", - "direct color", -}; - #define STAGE_ROWSTRIDE (GDK_SCRATCH_IMAGE_WIDTH * 3) /* Some of these fields should go, as they're not being used at all. (?) @@ -445,8 +435,8 @@ gdk_rgb_score_visual (GdkVisual *visual) pseudo = (visual->type == GDK_VISUAL_PSEUDO_COLOR || visual->type == GDK_VISUAL_TRUE_COLOR); if (gdk_rgb_verbose) - g_print ("Visual type = %s, depth = %d, %x:%x:%x%s; score=%x\n", - visual_names[visual->type], + g_print ("Visual type = %d, depth = %d, %x:%x:%x%s; score=%x\n", + visual->type, visual->depth, visual->red_mask, visual->green_mask, @@ -3066,8 +3056,8 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info) byte_order = image_info->visual->byte_order; if (gdk_rgb_verbose) - g_print ("Chose visual type=%s depth=%d, image bpp=%d, %s first\n", - visual_names[image_info->visual->type], image_info->visual->depth, + g_print ("Chose visual type=%d depth=%d, image bpp=%d, %s first\n", + image_info->visual->type, image_info->visual->depth, bpp, byte_order == GDK_LSB_FIRST ? "lsb" : "msb"); #if G_BYTE_ORDER == G_BIG_ENDIAN @@ -3235,10 +3225,10 @@ gdk_rgb_select_conv (GdkRgbInfo *image_info) if (!conv) { - g_warning ("Visual type=%s depth=%d, image bpp=%d, %s first\n" + g_warning ("Visual type=%d depth=%d, image bpp=%d, %s first\n" "is not supported by GdkRGB. Please submit a bug report\n" "with the above values to bugzilla.gnome.org", - visual_names[vtype], depth, bpp, + vtype, depth, bpp, byte_order == GDK_LSB_FIRST ? "lsb" : "msb"); exit (1); } diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 19b83f6c6a..61fddcbe71 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -539,12 +539,12 @@ pixbuf_supports_svg (void) { GSList *formats = gdk_pixbuf_get_formats (); GSList *tmp_list; - static gboolean found_svg = FALSE; - static gboolean value_known = FALSE; + static gint found_svg = -1; - if (value_known) + if (found_svg != -1) return found_svg; - + + found_svg = FALSE; for (tmp_list = formats; tmp_list && !found_svg; tmp_list = tmp_list->next) { gchar **mime_types = gdk_pixbuf_format_get_mime_types (tmp_list->data); @@ -560,7 +560,6 @@ pixbuf_supports_svg (void) } g_slist_free (formats); - value_known = TRUE; return found_svg; } -- 2.30.2